$(function(){

	$(".ways-item").click(function(){
		$(".erweima").show(300,function(){
			$(".mengban").css("display","block")
		});
	});
	
	$(".erweima").click(function(){
		let flag = confirm("确定支付吗?");
		if(flag){
			//获取订单号
			var orderid = $("[name='orderId']").val();
			$.post("shoppingCart.shtml",{"flag":"updateOrderState","orderid":orderid},function(d){ });
			// 支付完了
			$(".erweima>img:nth-child(1)").css("display","none");
			$(".erweima>img:nth-child(2)").hide();
			$(".erweima>img:nth-child(2)").slideDown(400);
			$(this).unbind();

			//5秒后跳回主页面
			let s = 5;
			var times = setInterval(function(){
				if(s==0){
					clearInterval(times);
					times = null;
					location.href = "../index.shtml";
				}
				$(".erweima").children("span").html("支付成功 <br />"+s+"秒后返回主页面");
				s--;
			},1000);
			
		}else{
			$(".erweima").hide(300,function(){
			$(".mengban").css("display","none")
		});
		}
	});
	
	
});